package com.jr.controller;

import com.jr.entry.Resume;
import com.jr.entry.User;
import com.jr.service.PersonalInformationService;
import com.jr.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/resume/")
public class ResumeController {

    @Autowired
    private ResumeService rs;
    @Autowired
    private PersonalInformationService pis;

    @RequestMapping("add")
    public ResponseEntity<Boolean> add(Resume resume) {
        boolean b = rs.addResume(resume);
        return ResponseEntity.ok(b);
    }

    @RequestMapping("select")
    public Resume select(User user) {
        Resume resume = rs.select(user);
        System.out.println(resume);
        return resume;
    }

    @RequestMapping("update")
    public ResponseEntity<Boolean> update(Resume resume) {
        boolean b = rs.update(resume);
        return ResponseEntity.ok(b);
    }

    @RequestMapping("selectUser")
    public User selectUser(User user) {
        User u = pis.selectUserInformation(user);
        return u;
    }
}
